<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login_pop.aspx.cs" Inherits="smasb2b.Login_pop" %>
<%@ Register TagPrefix="ddsc" Namespace="ddscControlLibrary" Assembly="ddscControlLibrary" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>Login_pop</title>
    <link href="CSS/css.css" type="text/css" rel="stylesheet">
    <base target="_self">
</head>
<body ms_positioning="GridLayout">
    <form id="Form1" method="post" runat="server">
        <table id="left" cellspacing="0" cellpadding="0" background="images/main_bg.jpg" border="0"
            runat="server">
            <tr>
                <td valign="top" align="right" width="240">
                    <img id="IMG2" height="99" src="/smasb2b/images/chin/title/login_title.jpg" width="225"
                        runat="server"></td>
            </tr>
            <tr>
                <td valign="top" align="right" width="240">
                    <table class="left" cellspacing="0" cellpadding="0" width="225" border="0">
                        <tr>
                            <td>
                                <table class="leftMenu" cellspacing="0" cellpadding="0" border="0">
                                    <tr>
                                        <td valign="top">
                                            <img height="10" src="/smasb2b/images/menu_01.jpg" width="205"></td>
                                    </tr>
                                    <tr>
                                        <td valign="top" align="center">
                                            <table class="menuContent1" cellspacing="0" cellpadding="0" width="90%" border="0">
                                                <tr>
                                                    <td colspan="2">
                                                        <asp:Label ID="lblMSG002" runat="server">請輸入統編：</asp:Label></td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2">
                                                        <ddsc:InputBoxCtrl ID="txtVENDER_ID" runat="server" MaxLength="12"></ddsc:InputBoxCtrl></td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2">
                                                        <asp:Label ID="lblMSG003" runat="server">請輸入密碼：</asp:Label></td>
                                                </tr>
                                                <tr>
                                                    <td style="HEIGHT: 12px" width="70%">
                                                        <ddsc:InputBoxCtrl ID="txtPASSWORD" runat="server" MaxLength="10" IsAllowLower="True" TextMode="Password"></ddsc:InputBoxCtrl></td>
                                                    <td style="HEIGHT: 12px" width="30%">
                                                        <input class="iconIMG02" id="btnLogin" onclick="TEST();" type="image" src="images/chin/button/button_go.gif"
                                                            name="imageField22" runat="server"></td>
                                                </tr>
                                                <tr>
                                                    <td style="HEIGHT: 2px" colspan="2">
                                                        <img height="5" src="/smasb2b/images/pix.gif" width="1"></td>
                                                </tr>
                                                <tr>
                                                    <td class="line1" colspan="2">
                                                        <img height="1" src="/smasb2b/images/pix.gif" width="1"></td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2">
                                                        <img height="5" src="/smasb2b/images/pix.gif" width="1"></td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2"><a class="menu1" href="javascript: var sWindow= window.dialogArguments;sWindow.location='/smasb2b/VND/VNDW0012.aspx'; this.close();">
                                                        <asp:Label ID="lblQUERYPW" runat="server">忘記密碼</asp:Label></a>|<a class="menu1" href="javascript: var sWindow= window.dialogArguments;sWindow.location='/smasb2b/VND/VNDW0013.aspx'; this.close();"><asp:Label ID="lblVENDERENTER" runat="server">新廠商登錄</asp:Label></a>
                                                        <asp:Label ID="lblVENDERENTER1" runat="server">新廠商登錄</asp:Label>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td valign="bottom">
                                            <img height="16" src="/smasb2b/images/menu_02.jpg" width="205"></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
    <script language="JavaScript">
        function TEST() {
            if (CheckLogin($("#txtVENDER_ID").val(), $("#txtPASSWORD").val())) {
                var obj = new Array($("#txtVENDER_ID").val(), $("#txtPASSWORD").val());

                window.returnValue = obj;
                window.close();
            }
        }

        //--------------------------------------------------------------------------------/
        //維護程式 - 檢查帳號密碼													  /
        //功能:檢查帳號密碼													  /
        //函式名稱 = CheckLogin									  /
        //--------------------------------------------------------------------------------/
        function CheckLogin(ID, PW) {

            var rtnvalue = true;
            try {
                if (ID != "") {
                    if (PW != "") {
                        //宣告元件
                        var XmlDocu = null;
                        // 新增XML 第一個節點(<form>) ，並指定id 為BASM050(程式名稱),method為Query_department_description(查詢function名稱)
                        addFormNode("Login_pop", "Query_Vendor");

                        // 新增第二層之節點(<command>),指定id 為department(將作為DataTableName,department 為實體DB 之Table名稱)      
                        // 並指定action 為SEL (共分四種action,查詢：SEL 新增：ADD 修改：UPD 刪除：DEL 將提供SQLConverter轉SQL作判斷) 
                        addCommandNode("V_VND_VENDOR", "sel");

                        // 新增第三層之第一個節點(<parameter>),指定id 為department_no,type為string(共有兩種：文字為string，數值為decimal)
                        // 並指定此節點的Text 為 docmnent.all.txtDEPARTMENT_NO.value(dropDonwlist之值)                                                                      
                        addParameterNode("VENDOR_NO", "string", ID);
                        addParameterNode("PW", "string", PW);
                        // 取得XML字串
                        xmlstr = getXML();
                        // 執行語法 (xml資料, 排序欄位, 資料起始位置)	
                        XmlDocu = ExecuteQuery(xmlstr);

                        // 測試 htmlDataSet
                        var htmlDataSet = new dataSetObject();
                        htmlDataSet.load(XmlDocu);

                        // 判斷是否取得資料
                        if (htmlDataSet != undefined) {
                            var Result = htmlDataSet.getTable("info").rows[0].getAttribute("ReturnCode");
                            if (Result != "000") {
                                alert(GetMessageByID("MSG061").text);

                                rtnvalue = false;
                            }
                        }
                    }
                    else {
                        alert(GetMessageByID("MSG003").text);
                        rtnvalue = false;
                    }
                }
                else {
                    alert(GetMessageByID("MSG002").text);
                    rtnvalue = false;
                }
            }
            catch (e) {
                ShowError(e.message);
            }
            return rtnvalue;
        }
    </script>
</body>
</html>

